<ix-modal-header
  [requiredRoles]="requiredRoles"
  [title]="title"
  [loading]="isFormLoading()"
></ix-modal-header>

<mat-card>
  <mat-card-content>
    <form class="ix-form-container" [formGroup]="form" (submit)="onSubmit()">
      <ix-fieldset [title]="'Group Configuration' | translate">
        <ix-input
          formControlName="gid"
          type="number"
          [label]="ignoreTranslation('GID')"
          [required]="true"
          [tooltip]="tooltips.gid | translate"
        ></ix-input>

        <ix-input
          formControlName="name"
          [label]="'Name' | translate"
          [required]="true"
          [tooltip]="tooltips.name | translate"
        ></ix-input>

        <ix-chips
          formControlName="privileges"
          [label]="'Privileges' | translate"
          [autocompleteProvider]="privilegesProvider"
          [tooltip]="tooltips.privileges | translate"
          [resolveValue]="true"
          [resolveOptions]="privilegeOptions$"
          [allowNewEntries]="false"
        ></ix-chips>

        <ix-chips
          formControlName="sudo_commands"
          [label]="'Allowed sudo commands' | translate"
        ></ix-chips>

        <ix-checkbox
          formControlName="sudo_commands_all"
          [label]="'Allow all sudo commands' | translate"
        ></ix-checkbox>

        <ix-chips
          formControlName="sudo_commands_nopasswd"
          [label]="'Allowed sudo commands with no password' | translate"
        ></ix-chips>

        <ix-checkbox
          formControlName="sudo_commands_nopasswd_all"
          [label]="'Allow all sudo commands with no password' | translate"
        ></ix-checkbox>

        <ix-checkbox
          formControlName="smb"
          [label]="'SMB Group' | translate"
          [tooltip]="tooltips.smb"
        ></ix-checkbox>
      </ix-fieldset>

      <ix-form-actions>
        <button
          *ixRequiresRoles="requiredRoles"
          mat-button
          type="submit"
          color="primary"
          ixTest="save"
          [disabled]="form.invalid || isFormLoading()"
        >
          {{ 'Save' | translate }}
        </button>
      </ix-form-actions>
    </form>
  </mat-card-content>
</mat-card>
